﻿@{
    Bundle("jquery_cookie");
    Layout = "../Shared/_Default.cshtml";
    ViewBag.PageTitle = T(Res.Name("Title"), JDM.Int32(Model.EntityID));
}

@section Breadcrumb
{
    <a href="@Url.Action(Loc.Act("Index"))">@T(Res.In("WebAdmin").Of("Navigation").Of("Publishing").Name("Publication"))</a> &gt;
}
<section class="box">
    <header>
        <ul class="bar toolbar">
        @if(Model.FileGroup != null)
        {
            <li><a id="@ID("btn_delete")" class="button" href="#">@T(Res.In("Common").Of("Act").Name("Delete"))</a></li>
        }
        else
        {
            <li><a class="button confirm" href="@Url.Action(Loc.Act("Delete").Set(new
            {
                id = JDM.Int32(Model.EntityID),
                deleteFileGroup = false
            }))">@T(Res.In("Common").Of("Act").Name("Delete"))</a></li>
        }
        </ul>
        <h3>@ViewBag.PageTitle</h3>
    </header>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            jQuery('@ID("#tabs")').tabs({
                create: function () {
                    jQuery(this).tabs('option', 'active', jQuery.cookie(jQuery(this).prop('id')));
                },
                activate: function (event, ui) {
                    jQuery.cookie(jQuery(this).prop('id'), ui.newTab.index());
                }
            });
        });
    </script>
    @if(Model.FileGroup != null)
    {
        <script type="text/javascript">
            jQuery(document).ready(function () {
                jQuery('@ID("#dlg_delete")').dialog();
                jQuery('@ID("#btn_delete")').click(function () {
                    jQuery('@ID("#dlg_delete")').dialog("open");
                });
            });
        </script>
    }
    <section>
        <div id="@ID("tabs")">
            <ul>
                <li><a href="@ID("#tab_1")">*</a></li>
                <li><a href="@ID("#tab_2")">@T(Res.Name("Translations"))</a></li>
                <li><a href="@ID("#tab_3")">@T(Res.Name("Tags"))</a></li>
                <li><a href="@ID("#tab_4")">@T(Res.Name("Attributes"))</a></li>
                @if(JDM.HasFlags(Model.Flags, "RatingAllowed"))
                {
                    <li><a href="@ID("#tab_5")">@T(Res.Name("Ratings"))</a></li>
                }
                @if(JDM.HasFlags(Model.Flags, "CommentAllowed"))
                {
                    <li><a href="@ID("#tab_6")">@T(Res.Name("Comments"))</a></li>
                }
            </ul>
            <div id="@ID("tab_1")">
            @{
                Html.RenderPartial("_Update");
            }
            </div>
            <div id="@ID("tab_2")">
            @{
                Html.RenderPartial("_Translations");
            }
            </div>
            <div id="@ID("tab_3")">
            @{
                Html.RenderPartial("_Tags");
            }
            </div>
            <div id="@ID("tab_4")">
            @{
                Html.RenderPartial("_Attributes");
            }
            </div>
            @if(JDM.HasFlags(Model.Flags, "RatingAllowed"))
            {
                <div id="@ID("tab_5")">
                @{
                    Html.RenderAction(Loc.Act("_Ratings").Set(new
                    {
                        publicationID = JDM.Int32(Model.EntityID)
                    }));
                }
                </div>
            }
            @if(JDM.HasFlags(Model.Flags, "CommentAllowed"))
            {
                <div id="@ID("tab_6")">
                @{
                    Html.RenderAction(Loc.Act("_Comments").Set(new
                    {
                        publicationID = JDM.Int32(Model.EntityID)
                    }));
                }
                </div>
            }
        </div>
        @if(Model.FileGroup != null)
        {
            <div id="@ID("dlg_delete")">
                <form action="@Url.Action(Loc.Act("Delete"))" method="get">
                    <input type="hidden" name="id" value="@JDM.Int32(Model.EntityID)" />
                    <table>
                        <tr>
                            <td>
                                <label>@T(Res.Name("DeleteFileGroup"))</label>
                            </td>
                            <td>
                                <input type="checkbox" name="deleteFileGroup" value="@Boolean.TrueString" />
                                <input type="hidden" name="deleteFileGroup" value="@Boolean.FalseString" />
                            </td>
                        </tr>
                    </table>
                    <ul class="bar toolbar">
                        <li><button class="button confirm" type="submit">@T(Res.In("Common").Of("Act").Name("Delete"))</button></li>
                    </ul>
                </form>
            </div>
        }
    </section>
</section>
